package com.example.uploadfile.controller;

import com.example.uploadfile.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class UploadController {

    @Autowired
    private UploadService uploadService;

    @RequestMapping(method = RequestMethod.POST,value = "/upload")
    public String upload(MultipartFile multipartFile){
        String url = this.uploadService.uploadFile(multipartFile);
        System.out.println(url);
        return url;
    }
}
